<#include "../imports/header.ftl" />

<!-- 表格重载条件区 -->
<div class="BMS-tableFormClass layui-form" layui-filter="BMS-tableFormFilter">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline">
                <input type="text" name="name" autocomplete="off" class="layui-input" placeholder="搜索名称">
            </div>
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="status">
                    <option value="">全部</option>
                    <option value="1">正常</option>
                    <option value="0">锁定</option>
                </select>
            </div>
        </div>
        <button class="layui-btn" lay-submit="" lay-event="reload" lay-filter="BMS-tableReloadFilter">搜索</button>
    </div>


</div>
<!-- 工具栏 -->
<div class="layui-btn-group" id="BMS-tableBarId">
    <button class="layui-btn" lay-event="add"><i class="layui-icon">&#xe654;</i></button>
</div>

<!-- 表格内容区 -->
<table id="BMS-tableId" lay-filter="BMS-tableFilter">
</table>

<!-- 行操作模板 -->
<script type="text/html" id="BMS-trOperateBarId">
    <a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
    <a href="/privilege/manage${sysProperties.urlSuffix}?manageid={{ d.id }}" class="layui-btn layui-btn-normal layui-btn-mini"
       lay-event="bindRole">角色</a>
    {{#  if(d.status === 1){ }}
    <a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="lock">锁定</a>
    {{#  } else { }}
    <a class="layui-btn layui-btn-mini" lay-event="unlock">解锁</a>
    {{#  } }}
</script>

<!-- 状态行样式模板 -->
<script type="text/html" id="BMS-trStyleStatus">
    {{#  if(d.status === 1){ }}
    <span style="color: #009688;">正常</span>
    {{#  } else { }}
    <span style="color: #FF5722;">锁定</span>
    {{#  } }}
</script>

<!-- 是否导航行样式模板 -->
<script type="text/html" id="BMS-trStyleIsNav">
    {{#  if(d.isnav === 1){ }}
    <i class="layui-icon" style="color:#009688">&#xe605;</i>
    {{#  } }}
</script>

<script>
    var $;
    layui.use(['layer', 'bmstable'], function () {
        var bmstable = layui.bmstable;

        // 自定义样式
        var trStyleStatusId = 'BMS-trStyleStatus';

        /**
         * 第一个参数对象为配置，第二个参数对象为自定义事件，自定义事件一定要是元素的 lay-event 值相对应才能调用
         */
        bmstable.render({
            trStyleIsNaveId: 'BMS-trStyleStatus'
            , trStyleIsNavId: 'BMS-trStyleIsNav'
            , url: '/manage/list.do'// 数据请求URL
            , editUrl: '/manage/edit.do'// 编辑URL
            , addUrl: '/manage/add.do'// 添加URL
            , delUrl: '-'// 删除URL
            , statusUrl: '/manage/status.do'// 状态操作URL
            , dialogSize: ['500px', '350px']
            , cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true, fixed: true}
                , {field: 'name', title: '账号', width: 150}
                , {field: 'createby', title: '创建人', width: 150}
                , {field: 'status', title: '状态', width: 60, templet:'#' + trStyleStatusId}
                , {
                    field: 'lastmodifypwdtime',
                    title: '密码最近修改时间',
                    date: true,
                    width: 200,
                    dateFormat: 'yyyy-MM-dd HH:mm:ss'
                }
                , {
                    field: 'createtime',
                    title: '创建时间',
                    date: true,
                    width: 200,
                    dateFormat: 'yyyy-MM-dd HH:mm:ss'
                }
                , {field: 'info', title:'描述', width:300, }
                , {title:'操作', width: 150, align: 'center', toolbar: '#' + bmstable.config.elems.trOperateBar}
            ]]
        }, {});
    });
</script>



<#include "../imports/footer.ftl" />